<template>
	<view class="heandtop">
		<view style="margin-left: 87%;" @click="systmsg">
			<view class="tishi" v-if="status == '1'"></view>
			<image class="xinxiimg" src="../../static/img/xiaoxi.png"></image>
		</view>
		<view class="content" style="margin-top:76upx;">
				<view style="text-align: right; color: #666666;"><text @click="geren">编辑</text></view>
				<view class="topimg">
					<image class="toxian" :src="head"></image>
				</view>
				<view class="name">
					{{nickname}}
				</view>
				<view class="haoma" style="width: 234upx;">
					<text>ID:{{uid}}</text>
				</view>
		</view>
		<view class="content">
			<view>
				<text class="moreset">更多设置</text>
				<view @click="pwd" class="setlist">
					<image class="tuicon" src="../../static/img/mima@2x.png"></image>
					<text style="margin-left: 20upx; color: #808080;">修改密码</text>
					<image class="qiantou" src="../../static/img/more@2x.png"></image>
				</view>
				<view class="setlist" @click="lianxi">
					<image class="tuicon" src="../../static/img/kefu.png"></image>
					<text style="margin-left: 20upx; color: #808080;">联系我们</text>
					<image class="qiantou" src="../../static/img/more@2x.png"></image>
				</view>
				<navigator url="../instructions/instructions" class="setlist">
					<image class="tuicon" src="../../static/img/shuoming.png"></image>
					<text style="margin-left: 20upx; color: #808080;">使用说明</text>
					<image class="qiantou" src="../../static/img/more@2x.png"></image>
				</navigator>
				<view class="setlist"  @click="fangkui">
					<image class="tuicon" src="../../static/img/fankui.png"></image>
					<text style="margin-left: 20upx; color: #808080;">意见反馈</text>
					<image class="qiantou" src="../../static/img/more@2x.png"></image>
				</view>
				<navigator url="../ourselves/ourselves" class="setlist">
					<image class="tuicon" src="../../static/img/women.png"></image>
					<text style="margin-left: 20upx; color: #808080;">关于我们</text>
					<image class="qiantou" src="../../static/img/more@2x.png"></image>
				</navigator>
				<view class="setlist1" @click="logoff">
					<image class="tuicon" src="../../static/img/exit.png"></image>
					<text style="margin-left: 20upx; color: #808080;">退出登录</text>
					<image class="qiantou" src="../../static/img/more@2x.png"></image>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				nickname:'',
				id:'',
				head:'',
				phone:'',
				qq:'',
				worktime:'',
				name2:'',
				name:'',
				pw:'',
				uid:'',
				possword:'',
				aduid:'',
				status:'',
				msg:''
			}
		},
		methods: {
			lianxi () {
				uni.request({
				   	url: 'http://xj.gccrw.cn/api/Set/connect',
				   	method: 'POST',
				   	data: {
						phone:'',
						qq:'',
						worktime:''
					},
				   	success: (res) => {
						console.log('----111111111111------',res.data.data.phone)
						this.phone = res.data.data.phone;
						this.qq = res.data.data.qq;
						this.worktime = res.data.data.worktime;
						uni.showActionSheet({
							itemList:['类型电话：'+this.phone,'工作时间：'+this.worktime,'类型QQ：'+this.qq],
							success: (res) => {
								if (res.tapIndex == 0){
									uni.makePhoneCall({
										phoneNumber: this.phone
									})
								}else if(res.tapIndex == 1){
									uni.showModal({
										title:'工作时间',
										content:this.worktime
									})
								}else if(res.tapIndex == 2){
									uni.showModal({
										title:'联系QQ',
										content:this.qq
									})
								}
							}
						})
					}
				})
			},
			systmsg () {
				uni.navigateTo({
					url:'/pages/msgsystem/msgsystem'
				})
			},
			geren () {
				uni.navigateTo({
					url: '/pages/personal/personal?name=' +  this.name + '&pw=' + this.possword
				})
			},
			pwd () {
				uni.navigateTo({
					url: '/pages/pwd/pwd?uid=' +  this.uid
				})
			},
			fangkui () {
				uni.navigateTo({
					url: '/pages/msgboard/msgboard?uid=' +  this.uid
				})
			},
			logoff () {
                uni.showModal({
                	content: '是否确认退出登录？',
                	success: (res) => {
                		if (res.confirm) {
							uni.request({
								url:'http://xj.gccrw.cn/api/index/login',
								data:{
									name:this.name,
									password:this.possword
								},
								method:'POST',
								success:(res) => {
									uni.reLaunch({
										url: '/pages/login/login'
									})
								}
							})
                		} else if (res.cancel) {
                			console.log('用户点击取消');
                		}
                	}
                })
			},
			getData () {
				uni.request({
						url: 'http://xj.gccrw.cn/api/index/login',
						data: {
							name:this.name,
							password:this.possword,
						},
						method: "POST",
						success: (res) => {
							this.nickname = res.data.data.user.nickname;
							this.id = res.data.data.user.id;
							this.head = res.data.data.user.head;
							this.uid = res.data.data.user.uid;
							this.status = res.data.data.push.status
						},
						fail:() => {
							uni.showToast({
								icon:'none',
								title:'请连接网络'
							})
						}
					})
				}
			},
			onShow () {
				this.getData();
			},
			onLoad (e) {
				this.name = e.name;
				this.possword = e.pw;
				this.aduid = e.admin_id;
				this.id1 = e.id;
				this.uid1 = e.uid;
			}
	    }
</script>

<style>
.heandtop {
	width: 100%;
	height: 160upx;
	background-color: #3C6DD2;
}
.xinxiimg {
	width: 48upx;
	height: 41upx;
	padding: 20upx;
}
.tishi {
	width: 20upx;
	height: 20upx;
	background-color: #FF0309;
	border-radius: 50%;
	position: absolute;
	margin-left: 48upx;
	margin-top: 13upx;
}
.topimg {
	width: 100%;
	display: flex;
	justify-content: center;
}
.toxian {
	width: 124upx;
	height: 124upx;
	margin-top: -126upx;
	border: 6upx solid #fff;
	border-radius: 50%;
	background-color: #EBEAEF;
}
.name {
	text-align: center;
	margin: 10upx;
	font-weight: bold;
}
.haoma {
	text-align: center;
	margin: 10upx;
	color: #B4B4B4;
	overflow: hidden;
	text-overflow: ellipsis;
	margin-left: 242upx;
}
.tuicon {
	width: 50upx;
	height: 50upx;
}
.setlist {
	padding: 30upx;
	border-bottom: 2upx solid #F6F6F6;
	display: flex;
}
.setlist1 {
	padding: 30upx;
	display: flex;
}
.qiantou {
	width: 22upx;
	height: 51upx;
	margin-left: 61%;
}
.moreset {
	border-left: 8upx solid #3C6DD2;
	padding-left: 14upx;
	font-weight: bold;
}
</style>
